<?php
header('Content-type:text/html;charset=utf-8');
$ReturnArray = array( // 返回字段
    "mch_id" => $_REQUEST["mch_id"], // 商户ID
    "out_trade_no" =>  $_REQUEST["out_trade_no"], // 订单号
    "total_fee" =>  $_REQUEST["total_fee"], // 交易金额
    "trade_state" => $_REQUEST["trade_state"],
    "sign" => $_REQUEST["sign"],
);
  
$Md5key = "aEjjy1CayRQ23zHggtPKFmHK6LT59n";

ksort($ReturnArray);
reset($ReturnArray);
$md5str = "";
foreach ($ReturnArray as $key => $val) {
    $md5str = $md5str . $key . "=" . $val . "&";
}
$sign = strtoupper(md5($md5str . "key=" . $Md5key)); 
if ($sign == $_REQUEST["sign"]) {
	
    if ($_REQUEST["returncode"] == "00") {

		   $str = "交易成功！订单号：".$_REQUEST["orderid"];
		   exit("SUCCESS");
    }
}

?>